package com.huahua.mapper;

import com.huahua.pojo.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author zzuli_huahua
 * @version 1.0
 * @date 2021/6/16 17:57
 */

@Mapper
@Repository
public interface UserMapper {

    // 查询用户、密码是否存在
    @Select("select * from user where userName=#{name} and passWord=#{passWord}")
    List<User> queryUser(@Param("name") String name, @Param("passWord") String passWord); //返回user结果

    // 添加用户、密码
    @Insert("insert into user(userName, passWord) values(#{name}, #{passWord}) ")
    int addUser(@Param("name") String name, @Param("passWord") String passWord); //返回数据库受影响（执行）行数

}
